home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 401-425 / disk_418 / psx / src / intui.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  3KB  |  95 lines

  1. /**********************************************************************/
  2. /*              Miscellaneous handy Intuition functions               */
  3. /**********************************************************************/
  4.  
  5. #include <exec/types.h>
  6. #include <intuition/intuition.h>
  7. #include <intuition/intuitionbase.h>
  8. #include <graphics/gfxbase.h>
  9. #include <Exec/libraries.h>
  10. #include <clib/intuition_protos.h>
  11. #include <clib/exec_protos.h>
  12. #include <clib/gadtools_protos.h>
  13. #include <clib/graphics_protos.h>
  14. #include <pragmas/exec.h>
  15. #include <pragmas/intuition.h>
  16. #include <pragmas/gadtools.h>
  17. #include <pragmas/graphics.h>
  18. #include <graphics/text.h>
  19.  
  20. struct IntuitionBase *IntuitionBase;
  21. struct GfxBase *GfxBase;
  22. struct Library *GadToolsBase;
  23.  
  24. struct TextFont *Topaz;
  25.  
  26. ULONG IntuitionVersion;
  27. ULONG GfxVersion;
  28. ULONG GadToolsVersion;
  29.  
  30. struct TextAttr Topaz80 =
  31.     {
  32.     "topaz.font",        /*  Name */
  33.     8,            /*  YSize */
  34.     0,            /*  Style */
  35.     0,            /*  Flags */
  36.     };
  37.  
  38. /**********************************************************************/
  39. /*               Open Intuition and Graphics libraries                */
  40. /**********************************************************************/
  41. int
  42. OpenLibraries(ULONG Version)
  43. {
  44. IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", Version);
  45. GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", Version);
  46. GadToolsBase = (struct GadToolsBase *)OpenLibrary("gadtools.library", Version);
  47.  
  48. if (!IntuitionBase || !GfxBase || !GadToolsBase) 
  49.     return(FALSE);
  50.  
  51. GfxVersion=GfxBase->LibNode.lib_Version;
  52. IntuitionVersion=IntuitionBase->LibNode.lib_Version;
  53. GadToolsVersion=GadToolsBase->lib_Version;
  54.  
  55. Topaz=OpenFont(&Topaz80);
  56. if (Topaz==0) return(FALSE);
  57.  
  58. return(TRUE);
  59. }
  60.  
  61.  
  62. /**********************************************************************/
  63. /*             Close the Intuition and Graphics libraries             */
  64. /**********************************************************************/
  65. void
  66. CloseLibraries(void)
  67. {
  68. if (IntuitionBase) CloseLibrary((struct Library *)IntuitionBase);
  69. if (GfxBase) CloseLibrary((struct Library *)GfxBase);
  70. if (GadToolsBase) CloseLibrary((struct Library *)GfxBase);
  71. if (Topaz) CloseFont(Topaz);
  72.  
  73. IntuitionBase=0;
  74. GfxBase=0;
  75. GadToolsBase=0;
  76. Topaz=0;
  77. }
  78.  
  79. /**********************************************************************/
  80. /*                 Simple interface to EasyRequest()                  */
  81. /**********************************************************************/
  82. int
  83. IntuiRequest(struct Window *Window, char *Text, char *Gadgets)
  84. {
  85. struct EasyStruct ES;
  86.  
  87. ES.es_StructSize=sizeof(ES);
  88. ES.es_Flags=0;
  89. ES.es_Title=NULL;
  90. ES.es_TextFormat=Text;
  91. ES.es_GadgetFormat=Gadgets;
  92.  
  93. return(EasyRequestArgs(Window, &ES, NULL, NULL));
  94. }
  95.